<?php

declare(strict_types = 1);

use Hyperf\HttpServer\Router\Router;
use App\Middleware\Auth\Admin;
use App\Admin\Controller\IndexController;
use App\Admin\Controller\GroupController;
use App\Admin\Controller\CommonController;
use App\Admin\Controller\MainController;
use App\Admin\Controller\MenuController;
use App\Admin\Controller\AdminController;
use \App\Admin\Controller\ConfController;
use \App\Admin\Controller\NavController;
use App\Admin\Controller\SlideController;
use App\Admin\Controller\CateController;
use App\Admin\Controller\ContentController;

// 不需要登录验证的接口
Router::addGroup('/admin', function(){
    Router::get('', [CommonController::class, 'login']);
    Router::get('/common/login', [CommonController::class, 'login']);
    Router::post('/common/login', [CommonController::class, 'login']);
    Router::get('/common/test', [CommonController::class, 'test']);
});

// 需要登录验证权限的接口
Router::addGroup('/admin', function(){
    Router::get('/index/index', [IndexController::class, 'index']);
    Router::get('/index/console', [IndexController::class, 'console']);
    Router::get('/index/getadminmenulist', [IndexController::class, 'getadminmenulist']);
    Router::get('/index/getrulelist', [IndexController::class, 'getrulelist']);
    Router::post('/index/upload', [IndexController::class, 'upload']);
    Router::post('/index/uploadbyedit', [IndexController::class, 'uploadByEdit']);
    Router::get('/group/index', [GroupController::class, 'index']);
    Router::post('/group/add', [GroupController::class, 'add']);
    Router::get('/group/add', [GroupController::class, 'add']);
    Router::post('/group/edit', [GroupController::class, 'edit']);
    Router::get('/group/edit', [GroupController::class, 'edit']);
    Router::post('/common/logout', [CommonController::class, 'logout']);
    Router::get('/common/clear', [CommonController::class, 'clear']);
    Router::get('/main/index', [MainController::class, 'index']);
    Router::get('/menu/index', [MenuController::class, 'index']);
    Router::get('/menu/add', [MenuController::class, 'add']);
    Router::post('/menu/add', [MenuController::class, 'add']);
    Router::get('/menu/edit', [MenuController::class, 'edit']);
    Router::post('/menu/edit', [MenuController::class, 'edit']);
    Router::get('/menu/delete', [MenuController::class, 'delete']);
    Router::get('/admin/index', [AdminController::class, 'index']);
    Router::post('/admin/index', [AdminController::class, 'index']);
    Router::get('/admin/edit', [AdminController::class, 'edit']);
    Router::post('/admin/edit', [AdminController::class, 'edit']);
    Router::get('/admin/add', [AdminController::class, 'add']);
    Router::post('/admin/add', [AdminController::class, 'add']);
    Router::get('/admin/delete', [AdminController::class, 'delete']);
    Router::get('/admin/editpassword', [AdminController::class, 'editPassword']);
    Router::post('/admin/editpassword', [AdminController::class, 'editPassword']);
    Router::get('/admin/editadmininfo', [AdminController::class, 'editadmininfo']);
    Router::post('/admin/editadmininfo', [AdminController::class, 'editadmininfo']);
    Router::get('/conf/index', [ConfController::class, 'index']);
    Router::post('/conf/confSubmit', [ConfController::class, 'confSubmit']);
    Router::get('/conf/oneindex', [ConfController::class, 'oneIndex']);
    Router::get('/conf/addone', [ConfController::class, 'addOne']);
    Router::post('/conf/addone', [ConfController::class, 'addOne']);
    Router::get('/conf/editone', [ConfController::class, 'editOne']);
    Router::post('/conf/editone', [ConfController::class, 'editOne']);
    Router::get('/conf/deleteone', [ConfController::class, 'deleteOne']);
    Router::get('/nav/index', [NavController::class, 'index']);
    Router::get('/nav/addgroup', [NavController::class, 'addGroup']);
    Router::post('/nav/addgroup', [NavController::class, 'addGroup']);
    Router::get('/nav/editgroup', [NavController::class, 'editGroup']);
    Router::post('/nav/editgroup', [NavController::class, 'editGroup']);
    Router::get('/nav/deletegroup', [NavController::class, 'deleteGroup']);
    Router::get('/nav/navindex', [NavController::class, 'Navindex']);
    Router::get('/nav/addnav', [NavController::class, 'addNav']);
    Router::post('/nav/addnav', [NavController::class, 'addNav']);
    Router::get('/nav/editnav', [NavController::class, 'editNav']);
    Router::post('/nav/editnav', [NavController::class, 'editNav']);
    Router::get('/nav/deletenav', [NavController::class, 'deleteNav']);
    Router::get('/slide/index', [SlideController::class, 'index']);
    Router::get('/slide/addgroup', [SlideController::class, 'addGroup']);
    Router::post('/slide/addgroup', [SlideController::class, 'addGroup']);
    Router::get('/slide/editgroup', [SlideController::class, 'editGroup']);
    Router::post('/slide/editgroup', [SlideController::class, 'editGroup']);
    Router::get('/slide/deletegroup', [SlideController::class, 'deleteGroup']);
    Router::get('/slide/slideindex', [SlideController::class, 'slideIndex']);
    Router::get('/slide/addslide', [SlideController::class, 'addSlide']);
    Router::post('/slide/addslide', [SlideController::class, 'addSlide']);
    Router::get('/slide/editslide', [SlideController::class, 'editSlide']);
    Router::post('/slide/editslide', [SlideController::class, 'editSlide']);
    Router::get('/slide/deleteslide', [SlideController::class, 'deleteSlide']);
    Router::get('/cate/cateindex', [CateController::class, 'cateIndex']);
    Router::get('/cate/addcate', [CateController::class, 'addCate']);
    Router::post('/cate/addcate', [CateController::class, 'addCate']);
    Router::get('/cate/editcate', [CateController::class, 'editCate']);
    Router::post('/cate/editcate', [CateController::class, 'editCate']);
    Router::get('/cate/deletecate', [CateController::class, 'deleteCate']);
    Router::get('/content/contentindex', [ContentController::class, 'contentIndex']);
    Router::get('/content/addcontent', [ContentController::class, 'addContent']);
    Router::post('/content/addcontent', [ContentController::class, 'addContent']);
    Router::get('/content/editcontent', [ContentController::class, 'editContent']);
    Router::post('/content/editcontent', [ContentController::class, 'editContent']);
    Router::get('/content/deletecontent', [ContentController::class, 'deleteContent']);
}, ['middleware' => [Admin::class]]);
